package org.cornland.systemWarning.service.impl;

import org.cornland.systemWarning.model.DataExceptionAlarm;
import org.cornland.systemWarning.mapper.DataExceptionAlarmMapper;
import org.cornland.systemWarning.service.DataExceptionAlarmService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Hawk Tang
 * @since 2021-11-03
*/


@Service
@Slf4j
public class DataExceptionAlarmServiceImpl extends ServiceImpl<DataExceptionAlarmMapper, DataExceptionAlarm> implements DataExceptionAlarmService {

   @Autowired
   private DataExceptionAlarmMapper dataExceptionAlarmMapper;

   public DataExceptionAlarm getLast(String wellId, Integer type){
       return dataExceptionAlarmMapper.getLast(wellId,type);
   }

    public DataExceptionAlarm getLastWithTag(String wellId, Integer type,String tag, Integer piType){
        return dataExceptionAlarmMapper.getLastWithTag(wellId,type,tag,piType);
    }

   public DataExceptionAlarm selectByPrimaryKey(Integer id){
        DataExceptionAlarm dataExceptionAlarm = dataExceptionAlarmMapper.selectById(id);
        return dataExceptionAlarm;
   }

   public List<DataExceptionAlarm> selectAll(){
        List<DataExceptionAlarm> dataExceptionAlarmList = dataExceptionAlarmMapper.selectList(null);
        return dataExceptionAlarmList;
   }

   public Integer insert(DataExceptionAlarm dataExceptionAlarm){
        int result = dataExceptionAlarmMapper.insert(dataExceptionAlarm);
        return result;
   }

   public Integer updateByPrimaryKey(DataExceptionAlarm dataExceptionAlarm){
        int result = dataExceptionAlarmMapper.updateById(dataExceptionAlarm);
        return result;
   }

   public Integer deleteByPrimaryKey(Integer id){
        int result = dataExceptionAlarmMapper.deleteById(id);
        return result;
   }

    @Override
    public Map<String, Object> findDataExceptionAlarmConfig(int type) {
        return dataExceptionAlarmMapper.findDataExceptionAlarmConfig(type);
    }


}